package cn.lxkroom.crm.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import sun.misc.BASE64Encoder;

public class MD5Util {
	public static String md5(String str) {
		try {
			MessageDigest  md=MessageDigest.getInstance("MD5");
			byte[] b = md.digest("str".getBytes());  //GBK  返回的是二进制，不一定是可见字符
			//数据指纹
			return new BASE64Encoder().encode(b);  //转成可见字符串
		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
